<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="hmg.common.CommonUtils"%>
<%@ page import="hmg.vo.BoardVO"%>
<%@ page import="java.util.List"%>
<%-- 
    JSP Name : jspName.jsp
    Description : 설명을 기술합니다.
    author Kim hyung soo
    since 2012. 9. 20.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 9. 20.     Kim hyung soo     최초 생성
--%>
<%
    String currPage = CommonUtils.getParameter(request.getParameter("page"), "1");
    String totalSearches = CommonUtils.getParameter(request.getParameter("totalSearches"), "0");
    String dicts = CommonUtils.getParameter(request.getParameter("dicts"), "0");
    String news = CommonUtils.getParameter(request.getParameter("news"), "0");
    String acts = CommonUtils.getParameter(request.getParameter("acts"), "0");
    String recs = CommonUtils.getParameter(request.getParameter("recs"), "0");
    String vods = CommonUtils.getParameter(request.getParameter("vods"), "0");
    String photos = CommonUtils.getParameter(request.getParameter("photos"), "0");
    String searchKeyword = CommonUtils.getDecodedParameter(request.getParameter("searchKeyword"), "");

    List<BoardVO> recruitList = (List<BoardVO>) request.getAttribute("RecruitList");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="ko" xml:lang="ko" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>통합검색 | 현대자동차그룹</title>
<meta name="description" content="현대자동차그룹 홈페이지 내 통합 검색하기" />
<meta name="keywords" content="현대자동차그룹 통합검색, 현대차그룹, 통합검색, 통합검색, 검색" />
<%@ include file="/WEB-INF/jsp/web/kor/include/header.jspf" %>
<script type="text/javascript">
var page = "<%= currPage %>";
var totalSearches = "<%= totalSearches %>";
var dicts = "<%= dicts %>";
var news = "<%= news %>";
var acts = "<%= acts %>";
var recs = "<%= recs %>";
var vods = "<%= vods %>";
var photos = "<%= photos %>";

$(document).ready(function(){
    if (page == "")
        page = "1";

    $("#paging").html(getNewsPagingString(<%= recs %>, page, 10, 10)); 
});

function fn_search() {
    var keyword = $("#searchKeyword").val();
    
    if (keyword == "") {
        alert("검색어를 입력해 주세요.");
        return;
    }
    else if (keyword.length < 2) {
        alert("검색어를 2자 이상 입력해 주세요.");
        return;
    }

    document.location.href = "./UnifiedSearch.do?searchKeyword=" + escape(encodeURIComponent(keyword)) + "&page=1";
}

function fn_search_result(listType) {
    var keyword = escape(encodeURIComponent($("#searchKeyword").val()));
    
    switch (listType) {
        case 0 : document.location.href = "/hmg/web/kor/sch/trm/TermDictionaryList.do?searchKeyword=" + keyword; break;
        case 1 : document.location.href = "/hmg/web/kor/sch/nfd/UnifiedSearch.do?searchKeyword=" + keyword; break;
        case 2 : document.location.href = "/hmg/web/kor/sch/nfd/UnifiedSearchNews.do?searchKeyword=" + keyword + "&totalSearches=" + totalSearches + "&dicts=" + dicts + "&news=" + news + "&acts=" + acts + "&recs=" + recs + "&vods=" + vods + "&photos=" + photos + "&page=1"; break;
        case 3 : document.location.href = "/hmg/web/kor/sch/nfd/UnifiedSearchAct.do?searchKeyword=" + keyword + "&totalSearches=" + totalSearches + "&dicts=" + dicts + "&news=" + news + "&acts=" + acts + "&recs=" + recs + "&vods=" + vods + "&photos=" + photos + "&page=1"; break;
        case 4 : document.location.href = "/hmg/web/kor/sch/nfd/UnifiedSearchRecruit.do?searchKeyword=" + keyword + "&totalSearches=" + totalSearches + "&dicts=" + dicts + "&news=" + news + "&acts=" + acts + "&recs=" + recs + "&vods=" + vods + "&photos=" + photos + "&page=1"; break;
        case 5 : document.location.href = "/hmg/web/kor/sch/nfd/UnifiedSearchVod.do?searchKeyword=" + keyword + "&totalSearches=" + totalSearches + "&dicts=" + dicts + "&news=" + news + "&acts=" + acts + "&recs=" + recs + "&vods=" + vods + "&photos=" + photos + "&page=1"; break;
        case 6 : document.location.href = "/hmg/web/kor/sch/nfd/UnifiedSearchPhoto.do?searchKeyword=" + keyword + "&totalSearches=" + totalSearches + "&dicts=" + dicts + "&news=" + news + "&acts=" + acts + "&recs=" + recs + "&vods=" + vods + "&photos=" + photos + "&page=1"; break;
    }
}

function fn_move_page(pageNo){
    fn_common_move_page(pageNo, location.search, page, 10, <%= recs %>, "./UnifiedSearchRecruit.do");
}

</script>
</head>
<body>
<!--wrap-->
<div id="wrap">
    <!-- skip navigation -->
    <div id="skipnavition">
        <a href="#gnb">메뉴바로가기</a><a href="#content">본문바로가기</a>
    </div>
    <!--// skip navigation -->

    <hr />

    <!-- header-->
    <%@ include file="/WEB-INF/jsp/web/kor/include/left.jspf" %>
    <!--//header-->

    <hr />

    <!--container-->
    <div id="container">
        <div class="scroll-pane">
            <!-- 공통 -->
            <div class="subTitle">
                <div class="pageTitle">
                    <h2><img src="/hmg/images/web/kor/title/sch_Totalsearch.gif" alt="통합검색" /></h2>
                </div> 

                <div class="pageLocation">
                    <ul>
                        <li><a href="/hmg/web/kor/Main.do"><img src="/hmg/images/web/kor/common/location_home.gif" alt="홈"/></a></li>
                        <li class="nowPage"><a href="/hmg/web/kor/sch/nfd/UnifiedSearch.do">통합검색</a></li>
                    </ul>
                </div>
            </div>
            <!--//공통-->

            <!--contents-->
            <div id="content">

                <!-- 내용 -->
                <div class="total_search">
                    
                    <div class="total_searchBox">
                        <img src="/hmg/images/web/kor/sch/total_Search_Text01.gif" alt="상세검색" class="search_text"/>
                        <label class="hidden" for="searchKeyword">검색</label>
                        <input type="text" title="검색" id="searchKeyword" name="searchKeyword" value="<%= searchKeyword %>" onkeypress="javascript:if (event.keyCode==13) {fn_search();}" maxlength="50"/>
                        <a href="javascript:fn_search();"><img src="/hmg/images/web/kor/btn/btn_search.gif" alt="검색"  class="btn"/></a>
                    </div>

<%  if (searchKeyword != "") { %>
                    <p class="total_search_result">&quot;<span><%= searchKeyword %></span>&quot; 에 대한 검색결과가 총 <span><%= totalSearches %></span>건이 있습니다.</p>
<%  } %>
                
                    <div class="total_searchTab">
                        <ul class="tabs">
                            <li class="tab1"><a href="#" onclick="javascript:fn_search_result(1);">통합검색 (<span class="count"><%= totalSearches %></span>)</a></li>
                            <li class="tab2"><a href="#" onclick="javascript:fn_search_result(2);">그룹소식 (<span class="count"><%= news %></span>)</a></li>
                            <li class="tab3"><a href="#" onclick="javascript:fn_search_result(3);">사회공헌 (<span class="count"><%= acts %></span>)</a></li>
                            <li class="tab4"><a href="#" onclick="javascript:fn_search_result(4);" class="on">인재채용 (<span class="count"><%= recs %></span>)</a></li>
                            <li class="tab5"><a href="#" onclick="javascript:fn_search_result(5);">영상 (<span class="count"><%= vods %></span>)</a></li>
                            <li class="tab6"><a href="#" onclick="javascript:fn_search_result(6);">이미지 (<span class="count"><%= photos %></span>)</a></li>
                        </ul>
                    </div>

                    <!-- tabCont4  S// -->
                    <div id="tab_content04" class="tab_content">
                        <div class="titleWrap">
                            <div class="left"><h3>인재채용 (<span class="list_count"><%= recs %>건</span>)</h3></div>
                        </div>

                        <div class="recruit_list">
<%
    if (recruitList == null || recruitList.size() == 0)
        out.println("                            <dl style=\"text-align:center;\">검색된 게시물이 없습니다.</dl>");
    else {
        for (int idx = 0; idx < recruitList.size(); idx++) {
            BoardVO searchRecruit = recruitList.get(idx);
            
            if (idx + 1 < recruitList.size())
                out.println("                    <dl>");
            else
                out.println("                    <dl class=\"last\">");
%>
                                <dt class="company"><%= searchRecruit.getCompName() %></dt>
                                <dd class="information" style="width:98%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
                                    <a href="/hmg/web/kor/job/rct/RecruitView.do?listID=<%= searchRecruit.getListID() %>&compType=0"><%= searchRecruit.getTitle() %></a>
                                </dd>
                                <dd class="etc">
                                    <span class="career"><%= searchRecruit.getListName() %></span>
                                    <span class="period"> <%= searchRecruit.getEffectDate() %>~<%= searchRecruit.getExpireDate() %></span>
<%
            if (searchRecruit.getDday().equals("-1") == true)
                out.println("       <span class=\"day end\">마감</span>");
            else
                out.println("       <span class=\"day\">D-" + searchRecruit.getDday() + "</span>");
%>
                                </dd>
                            </dl>
<%
        }
    }
%>
                        </div>

                        <div class="gropnews_page mt20">
                            <div class="gropnews_page_left">
                                <ul id="paging"></ul>
                            </div>

                            <div class="gropnews_page_right">
                                <ul>
                                    <li><a href="javascript:fn_move_page('prev');"><img src="/hmg/images/web/kor/btn/btn_prev.gif" alt="이전페이지로 이동" /></a></li>
                                    <li><a href="javascript:fn_move_page('next');"><img src="/hmg/images/web/kor/btn/btn_next.gif" alt="다음페이지로 이동" /></a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <!-- tabCont4  E// -->
                </div>  
            </div>
            <!--// 내용 -->
        </div>
        <!--//contents-->
    </div>
    <!--//container-->

    <hr />

    <!--footer-->
    <%@ include file="/WEB-INF/jsp/web/kor/include/footer.jspf" %>
    <!--//footer-->
    <hr />
    <!--notice-->
    <%@ include file="/WEB-INF/jsp/web/kor/include/notice.jspf" %>
    <!--//notice-->
</div>
<!--//wrap-->
</body>
</html>